package com.hjl.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

/**
 * @author ServivE
 * @version 0.1
 * @className ServiceJavaConfig
 * @description
 * @date 2024/8/13 20:45
 * @since jdk17
 */
@Configuration
@ComponentScan(basePackages = {"com.hjl.service"})
@EnableTransactionManagement
@EnableAspectJAutoProxy

public class ServiceJavaConfig {
    @Bean
    public DataSourceTransactionManager transactionManager(DataSource dataSource) {
        DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
        transactionManager.setDataSource(dataSource);
        return transactionManager;
    }
}
